package io.wins.vertx.entity;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;
import io.wins.vertx.utils.UUIDUtils;
import org.apache.commons.lang3.StringUtils;

@DataObject(generateConverter = true)
public class Admin {
    private final String id;
    private String loginId;
    private String roleId;
    private String userName;
    private String phone;
    private String image;
    private String description;
    private boolean isDelete;
    private long createdOn;
    private long updatedOn;

    public Admin(final JsonObject json) {
        AdminConverter.fromJson(json, this);
        this.id = StringUtils.isEmpty(json.getString("id")) ?
            UUIDUtils.genId() : json.getString("id");
    }

    public JsonObject toJson() {
        final JsonObject json = new JsonObject();
        AdminConverter.toJson(this, json);
        return json;
    }

    public String getId() {
        return this.id;
    }

    public String getLoginId() {
        return this.loginId;
    }

    public void setLoginId(final String loginId) {
        this.loginId = loginId;
    }

    public String getRoleId() {
        return this.roleId;
    }

    public void setRoleId(final String roleId) {
        this.roleId = roleId;
    }

    public String getUserName() {
        return this.userName;
    }

    public void setUserName(final String userName) {
        this.userName = userName;
    }

    public String getPhone() {
        return this.phone;
    }

    public void setPhone(final String phone) {
        this.phone = phone;
    }

    public String getImage() {
        return this.image;
    }

    public void setImage(final String image) {
        this.image = image;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(final String description) {
        this.description = description;
    }

    public boolean isDelete() {
        return this.isDelete;
    }

    public void setDelete(final boolean delete) {
        this.isDelete = delete;
    }

    public long getCreatedOn() {
        return this.createdOn;
    }

    public void setCreatedOn(final long createdOn) {
        this.createdOn = createdOn;
    }

    public long getUpdatedOn() {
        return this.updatedOn;
    }

    public void setUpdatedOn(final long updatedOn) {
        this.updatedOn = updatedOn;
    }
}
